﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="referrer" content="always">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> <!--兼容手机不缩小-->
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <meta name="description" content="光华智能AGV云平台、致力于自动储运新境界。">
    <meta name="format-detection" content="telephone=no">
    <title>光华智能AGV日志页</title>
    <script src="Scripts/jquery-3.4.1.min.js"></script>
    <!--<script src="Scripts/jquery.cookie1.4.1.min.js"></script>-->
    <script src="Scripts/pad.js"></script>
    <link rel="stylesheet" type="text/css" href="Content/Site2.css">
    <link rel="stylesheet" type="text/css" href="Content/Log.css">
    <script>
        var intervar = setInterval(function () {
            getStatus();
        }, 500);

        var tim0;
        var str = '';
        function getStatus() {
            $.ajax({
                //url: 'http://192.168.2.139:8082/PadRequest.ashx',
                url: './PadRequest.ashx',
                type: 'post',
                data: {
                    id: 3,
                    name: 'getLog'
                },
                success: function (res) {
                    try {
                        jsn = $.parseJSON(res);

                        if (jsn.Error == 1) {
                            $('#prompt').text(jsn.str);
                        }
                        else {
                            var str = '<tr>' +
                                '<th>日期时间</th>' +
                                '<th>日志代码</th>' +
                                '<th>日志说明</th>' +
                                '</tr>';
                            for (var p in jsn) {       //遍历json数组时，这么写p为索引，0,1
                                str += '<tr>' +
                                    '<td>' + jsn[p].datetime + '</td>' +
                                    '<td>' + jsn[p].code + '</td>' +
                                    '<td>' + jsn[p].note + '</td>' +
                                    '</tr>';
                            }
                        }
                        $('#prompt').text('');
                    } catch (e) {
                        $('#prompt').text('返回数据格式错误！' + res);
                    }
                    $(".logtable").html(str);
                    var tim = new Date().getTime();
                    var interval = tim - tim0;
                    tim0 = tim;
                    $('#interval').text(interval);
                },
                error: function () {
                    $('#prompt').text('响应错误！');
                },
            });
        }
    </script>
</head>
<body>

    <div class="split2"></div>

    <table class="logtable">
    </table>

    <div class="split2"></div>

    <div class="zhouqi">
        <div>周期：</div><div id="interval"></div>
        <div id="prompt"></div>
    </div>

        <div class="split"></div>

        <div class="foot">佛山市光华智能设备有限公司</div>

        <div class="split2"></div>
</body>
</html>